<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
		<script src="js/axios.min.js"></script>
		<script src="js/vue.min.js"></script>
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a>
              <cite>工作者列表</cite></a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                           
                               <!-- <div class="layui-inline layui-show-xs-block">
                                    <input class="layui-input"  autocomplete="off" placeholder="开始日" name="start" id="start">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <input class="layui-input"  autocomplete="off" placeholder="截止日" name="end" id="end">
                                </div> -->
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" name="username" id="cxphonenum" placeholder="请输入账号" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn" onclick="cxoneworker()" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                                </div>
								<!-- <div class="layui-inline layui-show-xs-block">
								    <button class="layui-btn" onclick="xadmin.open('添加用户','./member-add.html',600,400)"><i class="layui-icon"></i>添加</button>
								</div> -->
								
                           
                        </div>
                        <div class="layui-card-header">
                           <!-- <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button> -->
                            <button class="layui-btn layui-btn-zc" onclick="getallcertworker()"><i class="layui-icon">&#xe605;</i>已认证</button>
							 <button class="layui-btn layui-btn-warm" onclick="getallshworker()"><i class="layui-icon">&#xe6b2;</i>审核中</button>
							 <button class="layui-btn layui-btn-normal" onclick="getallnocertworker()"><i class="layui-icon">&#xe607;</i>未认证</button>
							  <button class="layui-btn layui-btn-danger" onclick="getallstopworker()"><i class="layui-icon">&#x1006;</i>已停用</button>
                        </div>
                        <div class="layui-card-body layui-table-body layui-table-main">
                            <table class="layui-table layui-form">
                                <thead>
                                  <tr>
                                    
                                    <th>ID</th>
                                    <th>账号</th>
                                    <th>姓名</th>
                                    <th>身份证号</th>
                                    <th>性别</th>
                                    <th>所在省市</th>
									<th>账号状态</th>
                                    <th>操作</th></tr>
                                </thead>
                                <tbody id="message">
                                        
                                </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
                                  <a class="prev" href="">&lt;&lt;</a>
								  <span class="current">1</span>
                                  <a class="num" href="">2</a>
                                  <a class="num" href="">3</a>
                                  <a class="num" href="">4</a>
                                  <a class="next" href="">&gt;&gt;</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div> 
    </body>
	<script src="js/jquery.min.js"></script>
    <script>
		
		 /* 进入首页事件 */
		window.onload=function(){
			getallcertworker();
		}
		
		function getallcertworker(){
			/* var phonenum = getUrl();
			 var worker_forget = {phonenum: phonenum}; */
			 
			$("#message").html("");
			 
			 var url = "http://129.204.188.236:8080/qiangdan/web_getallcertworker";
			 
			 axios
			 .post(url)
			 .then(function(response) {
			 	console.log(response.data);
				
				if(response.data == "noworker"){
					alert("当前无已认证工作者");
				}else{
				
			 	 var jsonArray=eval(response.data);
			 	 for(var i = 0; i <= jsonArray.length; i++ ){
				 	 
				 response.data[i].status = "已认证";
				 
				
					
				 document.getElementById("message").innerHTML += "<tr>"+
				                        "<td>"+ i + "</td>"+
										"<td>"+response.data[i].phonenum+"</td>"+
										"<td>"+response.data[i].name+"</td>"+
										"<td>"+response.data[i].idcardnum+"</td>"+
										"<td>"+response.data[i].sex+"</td>"+
										"<td>"+response.data[i].city+"</td>"+
										
										"<td class='td-status'>"+
										  "<span class='layui-btn layui-btn-zc layui-btn-mini'>"+response.data[i].status+"</span>"+"</td>"+
										"<td class='td-manage'>"+
										  "<a   href='javascript:;' id='"+i+"' onclick='stop(this.id)'  title='停用'>"+
											"<i class='layui-icon'>"+'&#xe601;'+"</i>"+
										  "</a>"+
	
										  "<a title='编辑查看详情'  id='"+i+"' onclick='editworker(this.id)' href='javascript:;'>"+
											"<i class='layui-icon'>"+'&#xe642;'+"</i>"+
										  "</a>"+
										"</td>"+
										"</tr>"+
										 "<input type='hidden' id='ph"+i+"'>"+"</input>";
										
										document.getElementById("ph"+i+"").value = response.data[i].phonenum;
										
			     }
				 }
			 })
			 .catch(function(error){
			 	console.log(error);
			 });
		}
		
		function getallshworker(){
			/* var phonenum = getUrl();
			 var worker_forget = {phonenum: phonenum}; */
			 
			 $("#message").html("");
			 
			 var url = "http://129.204.188.236:8080/qiangdan/web_getallshworker";
			 
			 axios
			 .post(url)
			 .then(function(response) {
			 	console.log(response.data);
				
				if(response.data == "noworker"){
					alert("当前无审核中工作者");
				}else{
			 	 var jsonArray=eval(response.data);
			  for(var i = 0; i <= jsonArray.length; i++ ){
				  
				 response.data[i].status = "审核中";	
				 
				 
					 
				 document.getElementById("message").innerHTML += "<tr>"+
				                        "<td>"+ i + "</td>"+
										"<td>"+response.data[i].phonenum+"</td>"+
										"<td>"+response.data[i].name+"</td>"+
										"<td>"+response.data[i].idcardnum+"</td>"+
										"<td>"+response.data[i].sex+"</td>"+
										"<td>"+response.data[i].city+"</td>"+
										
										"<td class='td-status'>"+
										  "<span class='layui-btn layui-btn-warm layui-btn-mini' >"+response.data[i].status+"</span>"+"</td>"+
										"<td class='td-manage'>"+
										  "<a  id='"+i+"' href='javascript:;' onclick='shtg(this.id)' title='审核通过'>"+
											"<i class='layui-icon'>"+'&#xe601;'+"</i>"+
										  "</a>"+
			
										  
										  
										  
										"</td>"+
										"</tr>"+
										"<input type='hidden' id='ph"+i+"'>"+"</input>";
										
										document.getElementById("ph"+i+"").value = response.data[i].phonenum;
										
										
										
			     }
				 }
			 })
			 .catch(function(error){
			 	console.log(error);
			 });
		}
		
		function getallnocertworker(){
			/* var phonenum = getUrl();
			 var worker_forget = {phonenum: phonenum}; */
			 
			 $("#message").html("");
			 
			 var url = "http://129.204.188.236:8080/qiangdan/web_getallnocertworker";
			 
			 axios
			 .post(url)
			 .then(function(response) {
			 	console.log(response.data);
				
				if(response.data == "noworker"){
					alert("当前无未认证工作者");
				}else{
			 	 var jsonArray=eval(response.data);
			     for(var i = 0; i <= jsonArray.length; i++ ){
				  
				 response.data[i].status = "未认证";	
					 
				 document.getElementById("message").innerHTML += "<tr>"+
				                        "<td>"+ i + "</td>"+
										"<td>"+response.data[i].phonenum+"</td>"+
										"<td>"+response.data[i].name+"</td>"+
										"<td>"+response.data[i].idcardnum+"</td>"+
										"<td>"+response.data[i].sex+"</td>"+
										"<td>"+response.data[i].city+"</td>"+
										
										"<td class='td-status'>"+
										  "<span class='layui-btn layui-btn-normal layui-btn-mini' >"+response.data[i].status+"</span>"+"</td>"+
										"<td class='td-manage'>"+
										 //  "<a onclick='member_stop(this,'10001')' id='"+i+"' href='javascript:;'  title='启用'>"+
											// "<i class='layui-icon'>"+'&#xe601;'+"</i>"+
										 //  "</a>"+
			
										  "<a title='编辑' id='"+i+"' onclick='editworker(this.id)' href='javascript:;'>"+
											"<i class='layui-icon'>"+'&#xe642;'+"</i>"+
										  "</a>"+
										  
										  
										"</td>"+
										"</tr>"+
										"<input type='hidden' id='ph"+i+"'>"+"</input>";
										
										document.getElementById("ph"+i+"").value = response.data[i].phonenum;
										
										
			     }
				 }
			 })
			 .catch(function(error){
			 	console.log(error);
			 });
		}
		
		function getallstopworker(){
			/* var phonenum = getUrl();
			 var worker_forget = {phonenum: phonenum}; */
			 
			  $("#message").html("");
			 
			 var url = "http://129.204.188.236:8080/qiangdan/web_getallstopworker";
			 
			 axios
			 .post(url)
			 .then(function(response) {
			 	console.log(response.data);
				
				if(response.data == "noworker"){
					alert("当前无已停用工作者");
				}else{
				
			 	var jsonArray=eval(response.data);
			 	for(var i = 0; i <= jsonArray.length; i++ ){
					 
				 response.data[i].status = "已停用";
					
				 
						 
				 document.getElementById("message").innerHTML += "<tr>"+
				                        "<td>"+ i + "</td>"+
										"<td>"+response.data[i].phonenum+"</td>"+
										"<td>"+response.data[i].name+"</td>"+
										"<td>"+response.data[i].idcardnum+"</td>"+
										"<td>"+response.data[i].sex+"</td>"+
										"<td>"+response.data[i].city+"</td>"+
										
										"<td class='td-status'>"+
										  "<span class='layui-btn layui-btn-danger layui-btn-mini' >"+response.data[i].status+"</span>"+"</td>"+
										"<td class='td-manage'>"+
										  "<a  id='"+i+"' onclick='hfsy(this.id)' href='javascript:;'  title='恢复正常'>"+
											"<i class='layui-icon'>"+'&#xe601;'+"</i>"+
										  "</a>"+
			
										  "<a title='编辑'  id='"+i+"' onclick='editworker(this.id)' href='javascript:;'>"+
											"<i class='layui-icon'>"+'&#xe642;'+"</i>"+
										  "</a>"+
										  
										  
										"</td>"+
										"</tr>"+
										"<input type='hidden' id='ph"+i+"'>"+"</input>";
										
										document.getElementById("ph"+i+"").value = response.data[i].phonenum;
										
										
			     }
				 }
			 })
			 .catch(function(error){
			 	console.log(error);
			 });
		}
		
		function cxoneworker(){
			 
			  var phonenum = document.getElementById("cxphonenum").value;
			 
			  $("#message").html("");
			 
			 var url = "http://129.204.188.236:8080/qiangdan/web_cxoneworker/"+phonenum;
			 
			 axios
			 .post(url)
			 .then(function(response) {
			 	console.log(response.data);
				
				if(response.data == "nothisworker"){
					alert("工作者不存在");
				}else{
					
					if(response.data[0].status == "0"){
						response.data[0].status = "未认证";
					}else if(response.data[0].status == "1"){
						response.data[0].status = "已认证";
					}else if(response.data[0].status == "2"){
						response.data[0].status = "已停用";
					}else if(response.data[0].status == "3"){
						response.data[0].status = "审核中";
					}	
				 
		
				 document.getElementById("message").innerHTML += "<tr>"+
				                        "<td>"+ '0' + "</td>"+
										"<td>"+response.data[0].phonenum+"</td>"+
										"<td>"+response.data[0].name+"</td>"+
										"<td>"+response.data[0].idcardnum+"</td>"+
										"<td>"+response.data[0].sex+"</td>"+
										"<td>"+response.data[0].city+"</td>"+
										
										"<td class='td-status'>"+
										  "<span class='layui-btn layui-btn-cx layui-btn-mini' >"+response.data[0].status+"</span>"+"</td>"+
										"<td class='td-manage'>"+
										 
			
										  "<a title='编辑'  id='0' onclick='editworker(this.id)' href='javascript:;'>"+
											"<i class='layui-icon'>"+'&#xe642;'+"</i>"+
										  "</a>"+
										  
										  
										"</td>"+
										"</tr>"+
										"<input type='hidden' id='ph0'>"+"</input>";
										
										document.getElementById("ph0").value = response.data[0].phonenum;
										
										
			     
				 }
			 })
			 .catch(function(error){
			 	console.log(error);
			 });
		}
		
		function stop(id){
			var i = id;
			var phonenum = document.getElementById("ph"+i+"").value;
			//alert(phonenum);
			var url = "http://129.204.188.236:8080/qiangdan/web_stopworker/"+phonenum;
			
			 axios
			.post(url)
			.then(function(response) {
				console.log(response.data);
				
		
				if(response.data == "success"){
					alert("已停用");
					location.reload();
				}else{
					alert("停用失败");
				}	

			})
			.catch(function(error){
				console.log(error);
			});
		}
		
		function editworker(id){
			var i = id;
			var phonenum = document.getElementById("ph"+i+"").value;
	
		    xadmin.open("编辑查看详情",'member-edit.html?phonenum='+phonenum,800,500);
				
		}
		
		function shtg(id){
			var i = id;
			var phonenum = document.getElementById("ph"+i+"").value;
			var url = "http://129.204.188.236:8080/qiangdan/web_shtgworker/"+phonenum;
			
			 axios
			.post(url)
			.then(function(response) {
				console.log(response.data);
				
		
				if(response.data == "success"){
					alert("已通过");
					location.reload();
				}else{
					alert("通过失败");
				}	
		
			})
			.catch(function(error){
				console.log(error);
			});
		}
		
		function hfsy(id){
			var i = id;
			var phonenum = document.getElementById("ph"+i+"").value;
			var url = "http://129.204.188.236:8080/qiangdan/web_shtgworker/"+phonenum;
			
			 axios
			.post(url)
			.then(function(response) {
				console.log(response.data);
				
		
				if(response.data == "success"){
					alert("已恢复使用");
					location.reload();
				}else{
					alert("恢复失败");
				}	
		
			})
			.catch(function(error){
				console.log(error);
			});
		}
		
    </script>
</html>